package com.lwj.liwanjia.adapter;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;

import com.lwj.liwanjia.R;
import com.lwj.liwanjia.bean.HomeBean;
import com.superrecycleview.superlibrary.adapter.BaseViewHolder;
import com.superrecycleview.superlibrary.adapter.SuperBaseAdapter;

import java.util.List;

/**
 * 首页功能
 */

public class HomeClassifAdapter extends SuperBaseAdapter<HomeBean.DataBean> {

    public HomeClassifAdapter(Context context, List<HomeBean.DataBean> data) {
        super(context, data);
    }

    @Override
    protected void convert(BaseViewHolder holder, HomeBean.DataBean item, int position) {
        ImageView icon = holder.getView(R.id.icon_image);
        switch (item.getIndexButtonName()) {
            case "利万嘉超市":
                icon.setImageResource(R.mipmap.liwanjia);
                break;
            case "网上商城":
                icon.setImageResource(R.mipmap.wangshangshangcheng);
                break;
            case "二手市场":
                icon.setImageResource(R.mipmap.ershoushichang);
                break;
            case "农资市场":
                icon.setImageResource(R.mipmap.nongzishichang);
                break;
            case "健康管理":
                icon.setImageResource(R.mipmap.jiankangguanli);
                break;
            case "物流快递":
                icon.setImageResource(R.mipmap.wuliukuaidi);
                break;
            case "本地服务":
                icon.setImageResource(R.mipmap.bendifuwu);
                break;
            case "新闻视频":
                icon.setImageResource(R.mipmap.news);
                break;
            case "我的秘书":
                icon.setImageResource(R.mipmap.wodemishu);
                break;
            case "我的工作":
                icon.setImageResource(R.mipmap.work);
                break;
            case "一卡通":
                icon.setImageResource(R.mipmap.yikatong);
                break;
            case "更多":
                icon.setImageResource(R.mipmap.gengduo);
                break;
        }
        holder.setText(R.id.icon_name, item.getIndexButtonName());
    }

    @Override
    protected int getItemViewLayoutId(int position, HomeBean.DataBean item) {
        return R.layout.home_classify_item;
    }
}
